Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overflows with memory of max size #809

Merged
merged 3 commits into from
Jan 13, 2022
Merged

Conversation

gumb0
Copy link
Collaborator

@gumb0 gumb0 commented Jan 10, 2022

The first part of max-memory-related fixes, fixing an overflow happening on both 32-bit and 64-bit.

// will not overflow uint32_t.
assert(new_pages * PageSize <= std::numeric_limits<uint32_t>::max());
assert(memory_pages_to_bytes(new_pages) <= std::numeric_limits<uint32_t>::max());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion is fixed in follow-up PRs.

@gumb0 gumb0 requested review from axic and chfast January 10, 2022 12:04
lib/fizzy/limits.hpp Outdated Show resolved Hide resolved
@gumb0 gumb0 force-pushed the only-memory-size-helper branch from 267ddc0 to 20cb1a0 Compare January 10, 2022 16:44
@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #809 (20cb1a0) into master (95d5087) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #809   +/-   ##
=======================================
  Coverage   99.02%   99.02%           
=======================================
  Files          80       81    +1     
  Lines       12812    12825   +13     
=======================================
+ Hits        12687    12700   +13     
  Misses        125      125           
Flag Coverage Δ
rust 99.90% <ø> (ø)
spectests 90.04% <66.66%> (-0.06%) ⬇️
unittests 98.95% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/fizzy/execute.cpp 99.29% <100.00%> (+<0.01%) ⬆️
lib/fizzy/instantiate.cpp 100.00% <100.00%> (ø)
lib/fizzy/limits.hpp 100.00% <100.00%> (ø)
test/unittests/instantiate_test.cpp 100.00% <100.00%> (ø)

@gumb0 gumb0 merged commit cab8a7b into master Jan 13, 2022
@gumb0 gumb0 deleted the only-memory-size-helper branch January 13, 2022 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants